package se.teamscape.client.place;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.place.DefaultPlaceManager;
import net.customware.gwt.presenter.client.place.PlaceRequest;
import net.customware.gwt.presenter.client.place.TokenFormatter;

import com.google.inject.Inject;

/**
 * A basic place manager implementation that subclasses DefaultPlaceManger
 * from gwt-presenter.
 * 
 * @author Andreas Borglin
 * 
 */
public class BasicPlaceManager extends DefaultPlaceManager {

    private static TokenFormatter sFormatter;

    public static String toHistoryToken(String placeName) {

        PlaceRequest placeReq = new PlaceRequest(placeName);
        return sFormatter.toHistoryToken(placeReq);

    }

    @Inject
    public BasicPlaceManager(EventBus eventBus, TokenFormatter tokenFormatter, ShowPersonPlace spp, EditPersonPlace epp,
            ListTeamsPlace ltp, ListPlayersPlace lpp, WelcomePlace welcome) {
        super(eventBus, tokenFormatter, spp, epp, ltp, lpp, welcome);
        BasicPlaceManager.sFormatter = tokenFormatter;
    }

}
